Instrumenting a section of code, or software entity, with monitoring code is a common approach to extracting software behavior data for performance analysis. The section of code monitored may be a few instructions or an entire procedure. Extracted behavior data may then be utilized in analyzing the performance of the software entity. To instrument the code, hooks may be added before entering or after exiting the section of code (software entity). These hooks temporarily pass control to monitoring routines that collect, process, and/or save the behavior data. Each time a system processor executes the code of the software entity, the processor executes the monitoring code, thereby adding to the collection of behavior data.